<div class="entry center-block text-center">
	<div class="entry-container">
	<h1 class="text-info">范围</h1>
	<p class="text-danger"><?php echo $error;?></p>
<?php if ($remembered):?>
	<a href="<?php echo site_url('login/fast_login');?>" class="btn btn-lg btn-block btn-danger entry-btn">使用常用身份登录</a>
<?php endif;?>
	<form action="<?php echo site_url('login/verify');?>" method="post" id="fl" hidden>
		<input type="text" class="login-input" name="usernamel" id="usernamel" placeholder="用户名">
		<input type="password" class="login-input" name="passwordl" id="passwordl" placeholder="密码">
		<label class="pull-left text-muted" style="margin: 10px auto;">
			<input type="checkbox" name="rememberl" id="rememberl" value="1"> 作为常用身份
		</label>
	</form>
	<div class="entry-btns">
	<button class="btn btn-lg btn-block btn-warning entry-btn" onclick="t(this)">
<?php echo $remembered ? '使用其他身份登录' : '登录到范围';?>
	</button>
	<form action="<?php echo site_url('user/create');?>" method="post" id="fr" hidden>
		<input type="text" class="login-input" name="usernamer" id="usernamer" placeholder="用户名将用于登录">
		<input type="text" class="login-input" name="namer" id="namer" placeholder="昵称">
		<input type="password" class="login-input" name="passwordr" id="passwordr" placeholder="密码应包含数字和字母，长度6-16位">
		<input type="password" class="login-input" naem="passconfr" id="passconfr" placeholder="再次输入密码以确保牢记">
	</form>
	<button class="btn btn-lg btn-block btn-info entry-btn" onclick="t(this)">
		快速注册
	</button>
	</div>
	</div>
</div>

<script>
function cl(jqbtn) {
	if ($('#usernamel').val().length <= 0
		|| $('#passwordl').val().length <= 0) {
		jqbtn.attr('disabled', true);
	} else {
		jqbtn.attr('disabled', false);
	}
}
function cr(jqbtn) {
	if ($('#usernamer').val().length <= 0
		|| $('#passwordr').val().length <= 0
		|| $('#passconfr').val().length <= 0
		|| $('#namer').val().length <= 0 ) {
		jqbtn.attr('disabled', true);
	} else {
		jqbtn.attr('disabled', false);
	}
}
function t(btn) {
	var jqbtn = $(btn);
	if (jqbtn.hasClass('btn-warning')) {
		tl(jqbtn);
	}
	else if (jqbtn.hasClass('btn-info')){
		tr(jqbtn);
	}
}
function tl(jqbtn) {
	$('#fl').slideToggle('fast');
	jqbtn.text('登录');
	document.getElementById('fl').oninput = function() {
		cl(jqbtn);
	}
	jqbtn.click(function() {
		$('#fl').submit();
	});
	cl(jqbtn);
}
function tr(jqbtn) {
	$('#fr').slideToggle('fast');
	jqbtn.text('注册');
	document.getElementById('fr').oninput = function() {
		cr(jqbtn);
	}
	jqbtn.click(function() {
		$('#fr').submit();
	});
	cr(jqbtn);
}
</script>